<div class="view" id="c<?php echo $data->id; ?>">

    <b><?php echo "Đơn hàng số"; ?>:</b>
    <?php echo CHtml::encode($data->id); ?>
    <br />

    <b><?php echo CHtml::encode($data->getAttributeLabel('customer_id')); ?>:</b>
    <?php echo CHtml::encode($data->users->username); ?>
    <br /> 

    <b><?php echo CHtml::encode($data->getAttributeLabel('datetime')); ?>:</b>
    <?php echo CHtml::encode(Yii::app()->dateFormatter->formatDateTime($data->datetime, 'medium', 'medium')); ?>    
    <br />

    <b><?php echo CHtml::encode($data->getAttributeLabel('status_id')); ?>:</b>
    <span style="color: red"><?php echo CHtml::encode($data->status->status); ?></span>
    <br />

    <b>Mặt hàng:</b>
    <br/>
    <?php
    $orderproducts = OrderProduct::model()->findAll('order_id = :order_id', array(':order_id' => $data->id));
    foreach ($orderproducts as $orderproduct) {
        printf('<b>%s</b> %s <br/>', $orderproduct->amount, $orderproduct->product->name);
    }
    ?>
    <?php
    if ($data->status_id == 1) {
//        echo CHtml::linkButton('Hủy đơn hàng', array(
//            'submit' => array('order/delete', 'id' => $data->id),
//        ));
        echo CHtml::linkButton('Hủy đơn hàng', array(
            'submit' => array('order/delete', 'id' => $data->id),
            'confirm' => "Bạn có muốn hủy đơn hàng #{$data->id}?",
        ));
    }
    ?>


</div>